<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title>自定义跳转</title>
    <script type="text/javascript">
        function function1() {
            alert("即将跳转到百度");
            window.location.href = "https://www.baidu.com";
        }
        function function2(){
           if (window.confirm("是否跳转到百度？")){
               window.location.href = "https://www.baidu.com";  
           } 
        }
        function function3(){
            window.location.href=window.prompt("请输入自定义跳转的URL","https://www.baidu.com");
        }
    </script>
</head>
<body>
<button onclick="function1()">即将跳转到百度</button>
<button onclick="function2()">是否跳转到百度</button>
<button onclick="function3()">自定义跳转URL</button>
</body>
</html>